package com.tangsm.spring.boot.api.domain;

import javax.validation.constraints.Email;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * 用户信息
 *
 * @author tangsm
 */
public class UserInfo {
    /**
     * 姓名
     */
    @NotBlank(message = "姓名不能为空")
    @Size(min = 2, max = 10, message = "姓名必须是2-10个汉字")
    private String name;

    /**
     * 年龄
     */
    @NotNull
    @Min(value = 0, message = "年龄最小0岁")
    @Max(value = 200, message = "年龄最大200岁")
    private Integer age;

    /**
     * 学校
     */
    private String school;

    /**
     * 用户邮箱
     */
    @NotBlank(message = "用户邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     * 无参构造
     */
    public UserInfo() {
    }

    /**
     * 全参构造
     *
     * @param name   名称
     * @param age    年龄
     * @param school 学校
     */
    public UserInfo(String name, Integer age, String school, String email) {
        this.name = name;
        this.age = age;
        this.school = school;
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getSchool() {
        return school;
    }

    public void setSchool(String school) {
        this.school = school;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }
}
